RewriteEngine ON

RewriteCond %{HTTP_HOST} ^www.kailidahardware.vn [NC]
RewriteRule ^(.*) http://kailidahardware.vn$1 [R=301,L]

RewriteRule  ^/trang-chu-(.*).html /Default.aspx?language=$1 [I,U,L]
RewriteRule  ^/trang-chu.html /Default.aspx [I,U,L]

RewriteRule  ^/danh-muc-bai-viet/(.*)/(\d+)-trang-(\d+).html /Articles.aspx?CateID=$2&page=$3 [I,U,L]
RewriteRule  ^/bai-viet/(.*)/(\d+).html /ArticleDetails.aspx?ArticleID=$2 [I,U,L]
RewriteRule  ^/danh-muc-bai-viet/(.*)/(\d+).html /Articles.aspx?CateID=$2 [I,U,L]

RewriteRule  ^/danh-muc-san-pham/(.*)/(\d+)-trang-(\d+).html /Products.aspx?CateID=$2&page=$3 [I,U,L]
RewriteRule  ^/san-pham/(.*)/(\d+).html /ProductDetails.aspx?ProductID=$2 [I,U,L]
RewriteRule  ^/danh-muc-san-pham/(.*)/(\d+).html /Products.aspx?CateID=$2 [I,U,L]

RewriteRule  ^/danh-muc-hinh-anh/(.*)/(\d+)-trang-(\d+).html /Photos.aspx?CateID=$2&page=$3 [I,U,L]
RewriteRule  ^/danh-muc-hinh-anh/(.*)/(\d+).html /Photos.aspx?CateID=$2 [I,U,L]
RewriteRule  ^/hinh-anh/(.*)/(\d+)/(\d+)-trang-(\d+).html /PhotoDetails.aspx?PhotoID=$2&CateID=$3&page=$4 [I,U,L]
RewriteRule  ^/hinh-anh/(.*)/(\d+)/(\d+).html /PhotoDetails.aspx?PhotoID=$2&CateID=$3 [I,U,L]
RewriteRule  ^/hinh-anh/(.*)/(\d+).html /PhotoDetails.aspx?PhotoID=$2 [I,U,L]

RewriteRule  ^/danh-muc-video/(.*)/(\d+)-trang-(\d+).html /Videos.aspx?CateID=$2&page=$3 [I,U,L]
RewriteRule  ^/danh-muc-video/(.*)/(\d+).html /Videos.aspx?CateID=$2 [I,U,L]
RewriteRule  ^/video/(.*)/(\d+)/(\d+)-trang-(\d+).html /VideoDetails.aspx?VideoID=$2&CateID=$3&page=$4 [I,U,L]
RewriteRule  ^/video/(.*)/(\d+)/(\d+).html /VideoDetails.aspx?VideoID=$2&CateID=$3 [I,U,L]
RewriteRule  ^/video/(.*)/(\d+).html /VideoDetails.aspx?VideoID=$2 [I,U,L]

RewriteRule  ^/tim-kiem-san-pham/(.*)-trang-(\d+).html /SearchProduct.aspx?Keyword=$1&page=$2 [I,U,L]
RewriteRule  ^/tim-kiem-san-pham/(.*).html /SearchProduct.aspx?Keyword=$1 [I,U,L]

RewriteRule  ^/tim-kiem-bai-viet/(.*)-trang-(\d+).html /SearchArticle.aspx?Keyword=$1&page=$2 [I,U,L]
RewriteRule  ^/tim-kiem-bai-viet/(.*).html /SearchArticle.aspx?Keyword=$1 [I,U,L]

RewriteRule  ^/tim-kiem/(.*)-trang-(\d+).html /Search.aspx?Keyword=$1&page=$2 [I,U,L]
RewriteRule  ^/tim-kiem/(.*).html /Search.aspx?Keyword=$1 [I,U,L]

RewriteRule  ^/lien-he.html /Contact.aspx [I,U,L]

RewriteRule  ^/tags-san-pham/(.*)/(\d+).html /TagProduct.aspx?TagID=$2 [I,U,L]
RewriteRule  ^/tags-bai-viet/(.*)/(\d+).html /TagArticle.aspx?TagID=$2 [I,U,L]
RewriteRule  ^/tags/(.*)/(\d+).html /Tags.aspx?TagID=$2 [I,U,L]

RewriteRule  ^/keep-session.html /Resources/KeepSessionAlive.ashx [I,U,L]

RewriteRule  ^/Errors.html /Errors.aspx [I,U,L]
RewriteRule  ^/ErrorSystem.html /ErrorSystem.aspx [I,U,L]
